package com.zz.springboot.processor.bag.strategy;

import com.zz.springboot.anno.StrategyKeywords;
import com.zz.springboot.anno.StrategyType;
import com.zz.springboot.constant.TypeConstants;
import com.zz.springboot.exception.BizException;
import com.zz.springboot.initializer.NumDictRunner;
import com.zz.springboot.resp.enums.RespCodeEnum;
import com.zz.springboot.util.DataDealUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

/**
 * 单双解析策略
 */
@Component
@Slf4j
@StrategyType("oddEven")
@StrategyKeywords({"单", "双"})
public class BagOddsEvensStrategy implements BagStrategy {

    @Override
    public List<Integer> parseNum(String key) {

        return NumDictRunner.getOdds_evens_Map().get(key);
    }

    @Override
    public String getKey(String data) {
        for (String target : TypeConstants.oddEvenConstant) {
            if (data.contains(target)) return target;
        }
        return "";
    }
}
